from collections import namedtuple
from math import hypot

Card = namedtuple('Card', ['rank', 'suit'])

class Vector:
    def __init__(self, x=0, y=0):
        self.x = x
        self.y = y
    def __repr__(self):
        return ''

class FrenchDecks:
    ranks = [str(i) for i in range(2, 11)] + list('JQKA')
    suits = ['spades', 'hearts', 'diamonds', 'clubs']

    def __init__(self):
        self._card = [Card(suit=suit, rank=rank)
                      for suit in self.suits
                      for rank in self.ranks
                      ]

    def __getitem__(self, item):
        return self._card[item]

    def __len__(self):
        return len(self._card)


suit_vale = dict(spades=3, hearts=2, diamonds=1, clubs=0)


def spades_high(card: Card):
    rank_value = FrenchDecks.ranks.index(card.rank)
    return rank_value * 10 + suit_vale[card.suit]


if __name__ == '__main__':
    deck = FrenchDecks()
    print(len(deck))
    print(deck[12::13])
    print(spades_high(deck[1]))
    for card in sorted(deck, key=spades_high):
        print(card)
